package com.softserveinc.moviedbapp.model;

import android.graphics.Bitmap;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class MovieInfo {

	private int movieId;
	private String overview;
	private String trailerUrl;


	private List<String> backdropImagesUrls;
	private List<String> backdropHDImagesUrls;
	private List<String> cast;

	private String lastModifiedAt;
	private String mCastAsString;

	private Map<String, List<String>> mImagesUrls;

	private List<Bitmap> mBackdropBitmaps;

	// constructor
	public MovieInfo() {

	}

	public int getMovieId() {
		return movieId;
	}

	public void setMovieId(final int movieId) {
		this.movieId = movieId;
	}

	public String getOverview() {
		return overview;
	}

	public void setOverview(final String overview) {
		this.overview = overview;
	}

	public List<String> getBackdropImagesUrlsList() {
		return backdropImagesUrls;
	}

	public void setBackdropImagesUrls(final List<String> backdropImagesUrls) {
		this.backdropImagesUrls = backdropImagesUrls;
	}

	public String getTrailerUrl() {
		return trailerUrl;
	}

	public void setTrailerUrl(final String trailerUrl) {
		this.trailerUrl = trailerUrl;
	}

	public String getCast() {

		String castAsString = cast.toString();
		castAsString = castAsString.substring(1, castAsString.length() - 1);

		return castAsString;
	}

	public List<String> getCastList() {
		return cast;
	}

	public void setCast(final List<String> cast) {
		this.cast = cast;
	}

	public String getCastAsString() {
		if (cast != null) {
			setCastAsString(getCast());
		}
		return mCastAsString;
	}

	public void setCastAsString(final String mCastAsString) {
		this.mCastAsString = mCastAsString;
	}

	public List<String> getBackdropHDUrls() {
			return backdropHDImagesUrls;

	}

	public void setBackdropHDUrls(final List<String> backdropImagesUrlsHD) {
		this.backdropHDImagesUrls = backdropImagesUrlsHD;
	}

	public String getLastModifiedAt() {
		return lastModifiedAt;
	}

	public void setLastModifiedAt(final String lastModifiedAt) {
		this.lastModifiedAt = lastModifiedAt;
	}


	public Map<String, List<String>> getImagesUrls() {
		return mImagesUrls;
	}

	public void setImagesUrls(final Map<String, List<String>> mImagesUrls) {
		this.mImagesUrls = mImagesUrls;
	}

	public List<Bitmap> getBackdropBitmaps() {
		if (mBackdropBitmaps != null) {
			return mBackdropBitmaps;
		} else {
			mBackdropBitmaps = new ArrayList<Bitmap>();
			return mBackdropBitmaps;
		}
	}

	public void setBackdropBitmaps(final List<Bitmap> mBackdropBitmaps) {
		this.mBackdropBitmaps = mBackdropBitmaps;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append('\n');
		sb.append("MOVIE ID: ");
		sb.append(movieId);
		sb.append('\n');
		sb.append("Overview: ");
		sb.append(overview);
		sb.append('\n');
		sb.append("Cast: ");
		sb.append(mCastAsString);
		sb.append('\n');
		sb.append("Trailer: ");
		sb.append(trailerUrl);
		sb.append('\n');
		sb.append("Backdrops: ");
		sb.append(backdropImagesUrls);
		sb.append('\n');
		sb.append("HD Backdrops: ");
		sb.append(backdropHDImagesUrls);

		return sb.toString();
	}

}
